<template>
    <div class="log_box">
        <div class="left">
            <div class="left_box">
                <el-icon>
                    <Opportunity />
                </el-icon>
                控制台
            </div>
        </div>
        <div class="right">
            <div class="icon_box">
                <el-icon>
                    <HomeFilled />
                </el-icon>
            </div>
            <div class="icon_box">
                <el-icon>
                    <Delete />
                </el-icon>
            </div>
            <div class="icon_box">
                <el-icon>
                    <Rank />
                </el-icon>
            </div>
            <div class="user_box">
                <img src="../../src/assets/头像.jpg" alt="">
                <span>admin</span>
                <div class="hovers">
                    <div class="hover_top">
                        <img class="img1" src="../assets/头像.jpg" alt="">
                        <p class="p1">admin</p>
                        <p class="p2">22222</p>
                    </div>
                    <div class="btn_box">
                        <button class="btn1">个人资料</button>
                        <button class="btn2" @click="tui">退出</button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</template>

<script setup lang="ts">
import { HomeFilled, Delete, Rank } from '@element-plus/icons-vue'
import { Opportunity } from '@element-plus/icons-vue'
const emit = defineEmits(['selectStyle', 'outStyle'])
const router = useRouter()
const selectStyle = () => {
    emit('selectStyle')
}
const outStyle = () => {
    emit('outStyle');
}
const tui = () => {
    localStorage.removeItem('data')
    router.push('/login')
}

</script>

<style  lang="scss">
.log_box {

    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .left_box {
        margin-left: 20px;
        height: 50px;
        width: 100px;
        text-align: center;
        line-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .right {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .icon_box {
            height: 50px;
            width: 50px;
            text-align: center;
            line-height: 50px;
            font-size: 20px;
        }

        .user_box {
            position: relative;
            width: 110px;
            height: 50px;
            background-color: #00a0ff;
            display: flex;
            justify-content: center;
            align-items: center;

            &:hover>.hovers {
                display: block;
            }

            img {
                width: 30px;
                height: 30px;
                border-radius: 50%;
                margin-right: 5px;
            }

            span: {
                margin-right: 5px;
            }
        }
    }
}

.user-top {
    padding: 0 !important;
    height: 100px;
    width: 200px;
    background-color: #000;
}

.el-popover.el-popper {
    padding: 0 !important;
}

.hovers {
    display: none;
    width: 300px;
    position: absolute;
    right: 0;
    top: 50px;
    // box-shadow: 5px 5px 5px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 10px 5px 5px rgba(0, 0, 0, 0.2);

    .hover_top {
        background-color: #122d38;
        height: 180px;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        .img1 {
            width: 100px;
            height: 100px;
            border-radius: 50%;
        }

        p {
            color: #fff;
        }

        .p1 {
            font-size: 14px;
            margin: 10px 0;
        }

        .p2 {
            font-size: 14px;
        }
    }

    .btn_box {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 50px;
        line-height: 50px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 0 20px;

        .btn1 {
            background-color: #122d38;
            border: 0;
            color: #fff;
            height: 30px;
            width: 80px;
            border-radius: 5px;
        }

        .btn2 {
            background-color: #ff4d00;
            border: 0;
            color: #fff;
            height: 30px;
            width: 80px;
            border-radius: 5px;
        }
    }
}
</style>